package com.lovo.view.school;

import com.lovo.javafxComponent.LovoLabel;
import com.lovo.javafxComponent.LovoTextArea;
import com.lovo.javafxComponent.LovoTitle;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.layout.Pane;

/**
 * 审核对话框
 * @author lovo
 */
public class AuditingDialog extends Dialog {
    /**内容容器*/
    private Pane container = new Pane();
    /**审批意见文本框*/
    private LovoTextArea infoArea = new LovoTextArea("审批意见", 80, 300,container);

    /**学校主面板*/
    private SchoolPane schoolPane;
    /**
     * 构造方法
     */
    public AuditingDialog(SchoolPane schoolPane) {
        this.schoolPane = schoolPane;
        this.setTitle("审批学校");
        initComponent();
    }

    /**
     * 初始化组件
     */
    private void initComponent() {
        new LovoTitle("审批学校", 0, 30, container);
        container.setPrefSize(680, 400);
        this.getDialogPane().setContent(container);

        //学校名称文本框
        LovoLabel nameLabel = new LovoLabel("学校名称", 80, 100,container);
        //校长文本框
        LovoLabel leaderLabel = new LovoLabel("校长", 80, 150,container);
        //地址文本框
        LovoLabel addrLabel = new LovoLabel("学校地址", 80, 200,container);
        //学生人数文本框
        LovoLabel studentCountLabel = new LovoLabel("学生人数", 380, 100,container);
        //老师人数文本框
        LovoLabel teacherCountLabel = new LovoLabel("老师人数", 380, 150,container);
        //联系电话文本框
        LovoLabel phoneLabel = new LovoLabel("联系电话", 380, 200,container);
        //说明文本框
        LovoLabel infoLabel = new LovoLabel("说明", 80, 250,container);

        this.initInfo();


        ButtonType passedButtonType = new ButtonType("批准立项", ButtonData.YES);
        this.getDialogPane().getButtonTypes().add(passedButtonType);
        Button passedBtn = (Button) this.getDialogPane().lookupButton(passedButtonType);

        passedBtn.addEventFilter(ActionEvent.ACTION, event -> {
            // 点击批准立项按钮的事件处理
        });
        ButtonType failedButtonType = new ButtonType("驳回立项", ButtonData.NO);
        this.getDialogPane().getButtonTypes().add(failedButtonType);
        Button failedBtn = (Button) this.getDialogPane().lookupButton(failedButtonType);

        failedBtn.addEventFilter(ActionEvent.ACTION, event -> {
            // 点击驳回立项按钮的事件处理
        });


        ButtonType cancelButtonType = new ButtonType("取消", ButtonData.CANCEL_CLOSE);
        this.getDialogPane().getButtonTypes().add(cancelButtonType);

        this.showAndWait();
    }

    //------------------------

    /**
     * 初始化下拉框信息
     */
    private void initInfo() {

    }
}
